`
https://leetcode.cn/problems/valid-palindrome/
`

/**
 * @param {string} s
 * @return {boolean}
 */
var isPalindrome = function (s) {
  // 处理字符串
  const sl = []
  for (const c of s) {
    if (/[a-zA-z0-9]/.test(c)) {
      sl.push(c.toLowerCase())
    }
  }
  s = sl.join('')

  // 判断回文逻辑
  let left = 0, right = s.length - 1
  while (left < right) {
    if (s[left] !== s[right]) return false
    left++
    right--
  }
  return true
};

// ---- test case ----
console.log(isPalindrome("A man, a plan, a canal: Panama"))